package demo;

import java.lang.management.ManagementFactory;

import javax.management.MBeanServer;
import javax.management.ObjectName;

public class Agent {

	MBeanServer mbServer;

	ObjectName objectName;

	public Agent() {
		mbServer = ManagementFactory.getPlatformMBeanServer();
		try {
			
			MonitorBlogMBean mbean = new MonitorBlog();
			
			objectName = new ObjectName("demo:name=MonitorBlog");
			mbServer.registerMBean(mbean, objectName);
			
		} catch (Exception e) {
			e.printStackTrace();

		}

	}

}
